# Create figures of NPV vs duration of the effects #
  
  benefit = c("4075137", "5979407", "7800625", "9542865", "11209990", "12805659",	"14333342",	
                "15796329",	"17197737",	"18540523") # type data coming from excel sheet #
  
  benefit = as.numeric(benefit)
  
  cost1 = rep(10320000,10L) # cost including admin costs #
  
  cost2 = rep(7750000,10L) # cost excluding admin costs 
  
  NPV1 = (benefit - cost1)/1000000
  
  NPV2 = (benefit - cost2)/1000000
  
  time = as.data.frame(12*1:10)
  
  colnames(time) = "g"
  
  results = cbind(time,NPV1,NPV2)
  
  graph.npv = ggplot(results, aes(g,NPV1)) + 
    geom_line( size = 0.7, colour = "#377eb8") +
    geom_hline(yintercept = 0, colour = "#323232", lty = 2) +
    theme_minimal() + 
    scale_x_continuous(breaks = c(12,24,36,48,60,72,84,96,108,120)) +
    ylab("net present value (USD million)") + xlab("duration of benefits (months)") + 
    theme(plot.title = element_text(size=14, family="sans", hjust = 0.5, face = "bold"),
          axis.title.x = element_text(size=13, family="sans", face = "bold", colour = "#323232"), 
          axis.title.y = element_text(size=13, family="sans", face = "bold", colour = "#323232"),
          axis.text.x = element_text(size=13, family="sans", colour = "#323232"), 
          axis.text.y = element_text(size=13, family="sans", colour = "#323232"),
          panel.grid.major =  element_blank(), panel.grid.minor = element_blank(),
          axis.line = element_line(colour = "#323232", size = 0.6), 
          axis.ticks = element_line(colour = "#323232", size = 1),
          plot.margin = margin(1, 0.5, 0.5, 0.5, "cm") 
    )
  
  ggsave(graph.npv, file = "figures/figureS3.png", width=10, height=7.5, dpi = 600)  

  graph.npv = ggplot(results, aes(g,NPV2)) + 
    geom_line( size = 0.7, colour = "#377eb8") +
    geom_hline(yintercept = 0, colour = "#323232", lty = 2) +
    theme_minimal() + 
    scale_x_continuous(breaks = c(12,24,36,48,60,72,84,96,108,120)) +
    ylab("net present value (USD million)") + xlab("duration of benefits (months)") + 
    theme(plot.title = element_text(size=14, family="sans", hjust = 0.5, face = "bold"),
          axis.title.x = element_text(size=13, family="sans", face = "bold", colour = "#323232"), 
          axis.title.y = element_text(size=13, family="sans", face = "bold", colour = "#323232"),
          axis.text.x = element_text(size=13, family="sans", colour = "#323232"), 
          axis.text.y = element_text(size=13, family="sans", colour = "#323232"),
          panel.grid.major =  element_blank(), panel.grid.minor = element_blank(),
          axis.line = element_line(colour = "#323232", size = 0.6), 
          axis.ticks = element_line(colour = "#323232", size = 1),
          plot.margin = margin(1, 0.5, 0.5, 0.5, "cm") 
    )
  
  ggsave(graph.npv, file = "figures/figureS4.png", width=10, height=7.5, dpi = 600)  
  
